//
// Copyright (C) 2011 - 2013  Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.2 with QuantLib 1.2.1
//#include "stdafx.h"
#include "DefaultProbKey.h"
using namespace Cephei::QL::Experimental::Credit;
#include <gen/QL/Currency.h>
#include <gen/QL/Experimental/Credit/DefaultType.h>
using namespace Cephei::QL;
#undef HANDLE
#undef ABSTRACT
#define STRUCT
Cephei::QL::Experimental::Credit::CDefaultProbKey::CDefaultProbKey (Cephei::Core::IVector<Cephei::QL::Experimental::Credit::IDefaultType^>^ eventTypes, Cephei::QL::ICurrency^ cur, QL::Experimental::Credit::SeniorityEnum sen) 
{
	_pSpinlock = new boost::detail::spinlock ();
    CCurrency^ _Ccur;
    try
    {
#ifdef HANDLE
        _phDefaultProbKey = NULL;
#endif
        eventTypes ->Lock ();
        INativeVector<Cephei::QL::Experimental::Credit::IDefaultType^>^ _NCIeventTypes = eventTypes->getFeature (NativeFeature::shared_ptr);
        CDefaultTypeVector^ _NCeventTypes = safe_cast<CDefaultTypeVector^>(_NCIeventTypes);
        std::vector<boost::shared_ptr<QuantLib::DefaultType> >& _eventTypes = static_cast<std::vector<boost::shared_ptr<QuantLib::DefaultType> >&> (_NCeventTypes->GetShared ());
        _Ccur = safe_cast<CCurrency^> (cur);
        _Ccur->Lock();
        QuantLib::Currency _cur = static_cast<QuantLib::Currency> (_Ccur->GetReference ()); 
        QuantLib::Seniority _sen = (QuantLib::Seniority)sen ;
        _ppDefaultProbKey = new boost::shared_ptr<QuantLib::DefaultProbKey> (new QuantLib::DefaultProbKey ( _eventTypes,  _cur,  _sen ));
        
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
        if (eventTypes != nullptr) eventTypes->Unlock();    //not optional
        if (_Ccur != nullptr) _Ccur->Unlock();
    }
}
Cephei::QL::Experimental::Credit::CDefaultProbKey::CDefaultProbKey () 
{
	_pSpinlock = new boost::detail::spinlock ();
    try
    {
#ifdef HANDLE
        _phDefaultProbKey = NULL;
#endif
        _ppDefaultProbKey = new boost::shared_ptr<QuantLib::DefaultProbKey> (new QuantLib::DefaultProbKey ( ));
        
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Experimental::Credit::CDefaultProbKey::CDefaultProbKey (boost::shared_ptr<QuantLib::DefaultProbKey>& childNative, Object^ owner) 
{
	_pSpinlock = new boost::detail::spinlock ();
#ifdef HANDLE
	_phDefaultProbKey = NULL;
#endif
	_ppDefaultProbKey = &childNative;
    
}
Cephei::QL::Experimental::Credit::CDefaultProbKey::CDefaultProbKey (QuantLib::DefaultProbKey& childNative, Object^ owner) 
{
#ifdef HANDLE
	_phDefaultProbKey = NULL;
#endif
	_ppDefaultProbKey = new boost::shared_ptr<QuantLib::DefaultProbKey> (&childNative);
    
    _DefaultProbKeyOwner = owner;
    
}

Cephei::QL::Experimental::Credit::CDefaultProbKey::CDefaultProbKey (CDefaultProbKey^ copy) 
{
	_pSpinlock = new boost::detail::spinlock ();
#ifdef HANDLE
	_phDefaultProbKey = NULL;
#endif
	if (copy->HasNative() != NULL)
    {
		_ppDefaultProbKey = new boost::shared_ptr<QuantLib::DefaultProbKey> (copy->GetShared());
        
    }
}
Cephei::QL::Experimental::Credit::CDefaultProbKey::CDefaultProbKey (PLATFORM::Type^ t) 
{
	_pSpinlock = new boost::detail::spinlock ();
#ifdef HANDLE
	_phDefaultProbKey = NULL;
#endif
	if (!t->IsSubclassOf(CDefaultProbKey::typeid))
		throw REFNEW Exception ("Invalid base-case init");
}
#ifdef HANDLE
Cephei::QL::Experimental::Credit::CDefaultProbKey::CDefaultProbKey (QuantLib::Handle<QuantLib::DefaultProbKey>& childNative, Object^ owner)  
{
	_pSpinlock = new boost::detail::spinlock ();
	_phDefaultProbKey = &childNative;
	_ppDefaultProbKey = &static_cast<boost::shared_ptr<QuantLib::DefaultProbKey>>(childNative.currentLink());
    
    _DefaultProbKeyOwner = owner;
}
Cephei::QL::Experimental::Credit::CDefaultProbKey::CDefaultProbKey (QuantLib::Handle<QuantLib::DefaultProbKey> childNative)  
{
	_pSpinlock = new boost::detail::spinlock ();
	_phDefaultProbKey = &childNative;
	_ppDefaultProbKey = &static_cast<boost::shared_ptr<QuantLib::DefaultProbKey>>(childNative.currentLink());
    
}
#endif
#ifdef STRUCT
Cephei::QL::Experimental::Credit::CDefaultProbKey::CDefaultProbKey (QuantLib::DefaultProbKey childNative)  
{
	_pSpinlock = new boost::detail::spinlock ();
#ifdef HANDLE
	_phDefaultProbKey = NULL;
#endif
	_ppDefaultProbKey = new boost::shared_ptr<QuantLib::DefaultProbKey> (new QuantLib::DefaultProbKey (childNative));
    
}
#endif

Cephei::QL::Experimental::Credit::CDefaultProbKey::~CDefaultProbKey ()
{
	if (_pSpinlock != NULL)
    {
        delete _pSpinlock;
        _pSpinlock = NULL;
    }
    if (_ppDefaultProbKey != NULL)
    {
	    delete _ppDefaultProbKey;
        _ppDefaultProbKey = NULL;
    }
}
Cephei::QL::Experimental::Credit::CDefaultProbKey::!CDefaultProbKey ()
{
	if (_pSpinlock != NULL)
    {
        delete _pSpinlock;
    }
    if (_ppDefaultProbKey != NULL)
    {
	    delete _ppDefaultProbKey;
    }
}
QuantLib::DefaultProbKey& Cephei::QL::Experimental::Credit::CDefaultProbKey::GetReference ()
{
    if (_ppDefaultProbKey == NULL) throw REFNEW NativeNullException ();
	return **_ppDefaultProbKey;
}
boost::shared_ptr<QuantLib::DefaultProbKey>& Cephei::QL::Experimental::Credit::CDefaultProbKey::GetShared ()
{
    if (_ppDefaultProbKey == NULL) throw REFNEW NativeNullException ();
	return *_ppDefaultProbKey;
}
QuantLib::DefaultProbKey* Cephei::QL::Experimental::Credit::CDefaultProbKey::GetPointer ()
{
    if (_ppDefaultProbKey == NULL) throw REFNEW NativeNullException ();
	return &**_ppDefaultProbKey;
}
#ifdef HANDLE
QuantLib::Handle<QuantLib::DefaultProbKey>& Cephei::QL::Experimental::Credit::CDefaultProbKey::GetHandle ()
{
	if (_phDefaultProbKey == NULL)
	{
		_phDefaultProbKey = new Handle<QuantLib::DefaultProbKey> (*_ppDefaultProbKey);
	}
	return *_phDefaultProbKey;
}
#endif
bool Cephei::QL::Experimental::Credit::CDefaultProbKey::HasNative () 
{
	return (_ppDefaultProbKey != NULL);
}

Cephei::QL::ICurrency^ Cephei::QL::Experimental::Credit::CDefaultProbKey::Currency::get ()
{
    try
    {
    	QuantLib::Currency& _rv = (QuantLib::Currency&)(*_ppDefaultProbKey)->currency ( );   
        Cephei::QL::CCurrency^ _nrv = REFNEW Cephei::QL::CCurrency (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::Core::IVector<Cephei::QL::Experimental::Credit::IDefaultType^>^ Cephei::QL::Experimental::Credit::CDefaultProbKey::EventTypes::get ()
{
    try
    {
    	std::vector<boost::shared_ptr<QuantLib::DefaultType> >& _rv = (std::vector<boost::shared_ptr<QuantLib::DefaultType> >&)(*_ppDefaultProbKey)->eventTypes ( );   
        CoVector<Cephei::QL::Experimental::Credit::IDefaultType^>^ _nrv = REFNEW CoVector<Cephei::QL::Experimental::Credit::IDefaultType^>(REFNEW CDefaultTypeVector (_rv, this));
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
QL::Experimental::Credit::SeniorityEnum Cephei::QL::Experimental::Credit::CDefaultProbKey::Seniority::get ()
{
    try
    {
    	QuantLib::Seniority _rv = (QuantLib::Seniority)(*_ppDefaultProbKey)->seniority ( );   
        QL::Experimental::Credit::SeniorityEnum _nrv = (QL::Experimental::Credit::SeniorityEnum)_rv;
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
UInt64 Cephei::QL::Experimental::Credit::CDefaultProbKey::Size::get ()
{
    try
    {
    	QuantLib::Size _rv = (QuantLib::Size)(*_ppDefaultProbKey)->size ( );   
        UInt64 _nrv = _rv; //c1
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::CDefaultProbKeyVector ()
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
}
Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::~CDefaultProbKeyVector ()
{
#ifdef STRUCT
	if (_pVValue != NULL) delete _pVValue;
	_pVValue = NULL;
#endif   
	if (_pVBoost != NULL) delete _pVBoost;
	_pVBoost = NULL;
#ifdef HANDLE
	if (_pVHand != NULL) delete _pVHand;
	_pVHand = NULL;
#endif
}
Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::!CDefaultProbKeyVector ()
{
#ifdef STRUCT
	if (_pVValue != NULL) delete _pVValue;
#endif   
	if (_pVBoost != NULL) delete _pVBoost;
#ifdef HANDLE
	if (_pVHand != NULL) delete _pVHand;
#endif
}
#ifdef STRUCT
Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::CDefaultProbKeyVector (std::vector<QuantLib::DefaultProbKey>& vec, Object^ owner)
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
	_pVValue = &vec;
	_owner = owner;
}
Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::CDefaultProbKeyVector (std::vector<QuantLib::DefaultProbKey> vec)
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
	_pVValue = new std::vector<QuantLib::DefaultProbKey> (vec);
}
#endif
Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::CDefaultProbKeyVector (std::vector<boost::shared_ptr<QuantLib::DefaultProbKey>>& vec, Object^ owner)
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
	 _pVBoost = &vec;
	_owner = owner;
}
#ifdef HANDLE
Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::CDefaultProbKeyVector (std::vector<QuantLib::Handle<QuantLib::DefaultProbKey>>& vec, Object^ owner)
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
	 _pVHand = &vec;
	_owner = owner;
}
#endif

int Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::Count::get ()
{
#ifdef STRUCT
	if (_pVValue != NULL) 
	{
		return _pVValue->size();
	}
#endif    
	if (_pVBoost != NULL)
	{
		return _pVBoost->size ();
	}
#ifdef HANDLE
	if (_pVHand != NULL)
	{
		return _pVHand->size ();
	}
#endif
	return 0;		// should never happen
}
Cephei::QL::Experimental::Credit::IDefaultProbKey^ Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::default::get (int index) 
{
#ifdef STRUCT
	if (_pVValue != NULL) 
	{
    	if ((size_t)index >= _pVValue->size()) throw REFNEW RangeException ();
		QuantLib::DefaultProbKey& native = (*_pVValue)[index];
		return REFNEW CDefaultProbKey (native, this);
	}
#endif    
	if (_pVBoost != NULL)
	{
    	if ((size_t)index >= _pVBoost->size()) throw REFNEW RangeException ();
		QuantLib::DefaultProbKey& native = *(*_pVBoost)[index];
		return REFNEW CDefaultProbKey (native, this);
	}
#ifdef HANDLE
	if (_pVHand != NULL)
	{
    	if ((size_t)index >= _pVHand->size()) throw REFNEW RangeException ();
		QuantLib::DefaultProbKey& native = *((*_pVHand)[index].currentLink ());
		return REFNEW CDefaultProbKey (native, this);
	}
#endif
	return nullptr;		// can never be the case
}
void Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::default::set (int index, Cephei::QL::Experimental::Credit::IDefaultProbKey^ value) 
{
#ifdef STRUCT
	if (_pVValue != NULL)
	{
		if (_pVValue->size() <= (size_t)index)
		{
			// can't happen because vectors are filled from List<> sequentially
			if (_pVValue->size() < (size_t)index)
			{
				throw REFNEW RangeException ();
			}
			_pVValue->push_back (dynamic_cast<CDefaultProbKey^>(value)->GetReference ());
		}
        else
        {
            QuantLib::DefaultProbKey& c = (*_pVValue)[index];
            c = dynamic_cast<CDefaultProbKey^>(value)->GetReference ();
        }
	}
#endif   
	if (_pVBoost != NULL)
	{
		if (_pVBoost->size() <= (size_t)index)
		{
			// can't happen because vectors are filled from List<> sequentially
			if (_pVBoost->size() < (size_t)index)
			{
				throw REFNEW RangeException ();
			}
			_pVBoost->push_back (dynamic_cast<CDefaultProbKey^>(value)->GetShared ());
		}
		boost::shared_ptr<QuantLib::DefaultProbKey>& c = (*_pVBoost)[index];
		c = dynamic_cast<CDefaultProbKey^>(value)->GetShared ();
	}
#ifdef HANDLE
	if (_pVHand != NULL)
	{
		if (_pVHand->size() <= (size_t)index)
		{
			// can't happen because vectors are filled from List<> sequentially
			if (_pVHand->size() < (size_t)index)
			{
				throw REFNEW RangeException ();
			}
			_pVHand->push_back (QuantLib::Handle<QuantLib::DefaultProbKey> ());
		}
		QuantLib::Handle<QuantLib::DefaultProbKey>& c = (*_pVHand)[index];
		boost::shared_ptr<QuantLib::DefaultProbKey>& b = static_cast<boost::shared_ptr<QuantLib::DefaultProbKey>>(c.currentLink());
		b = dynamic_cast<CDefaultProbKey^>(value)->GetShared ();
	}
#endif
}
Cephei::Core::Generic::ICoCell<Cephei::QL::Experimental::Credit::IDefaultProbKey^>^ Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::CItem::get (int index) 
{
	return CellFactory::Instance->Create<IDefaultProbKey^> (dynamic_cast<IDefaultProbKey^>(default[index]));
}

void Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::CItem::set (int index, Cephei::Core::Generic::ICoCell<Cephei::QL::Experimental::Credit::IDefaultProbKey^>^ value) 
{
	default[index] = safe_cast<IDefaultProbKey^>(value->Value);
}
#ifdef STRUCT
std::vector<QuantLib::DefaultProbKey>& Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::GetReference ()
{
	 return *_pVValue;
}
#endif

std::vector<boost::shared_ptr<QuantLib::DefaultProbKey>>& Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::GetShared ()
{
	return *_pVBoost;
}

#ifdef HANDLE
std::vector<QuantLib::Handle<QuantLib::DefaultProbKey>>& Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::GetHandle ()
{
	return *_pVHand;
}
#endif
bool Cephei::QL::Experimental::Credit::CDefaultProbKeyVector::PrepareFeature (NativeFeature feature)
{
	switch (feature)
	{
#ifdef STRUCT
		case NativeFeature::Value :
			if (_pVValue == NULL)
			{
				_pVValue = new std::vector<QuantLib::DefaultProbKey> ();
				return true;
			}
			break;
#endif
        case NativeFeature::shared_ptr :
			if (_pVBoost == NULL)
			{
				_pVBoost = new std::vector<boost::shared_ptr<QuantLib::DefaultProbKey>> ();
				return true;
			}
			break;
#ifdef HANDLE
        case NativeFeature::Handle :
            if (_pVHand == NULL)
            {
                _pVHand = new std::vector<QuantLib::Handle<QuantLib::DefaultProbKey>> ();
                return true;
            }
            break;
#endif
	}
	return false;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Factory class

Cephei::QL::Experimental::Credit::IDefaultProbKey^ Cephei::QL::Experimental::Credit::CDefaultProbKey_Factory::Create (Cephei::Core::IVector<Cephei::QL::Experimental::Credit::IDefaultType^>^ eventTypes, Cephei::QL::ICurrency^ cur, QL::Experimental::Credit::SeniorityEnum sen)
{
    return REFNEW CDefaultProbKey ( eventTypes,  cur,  sen);
}
Cephei::QL::Experimental::Credit::IDefaultProbKey^ Cephei::QL::Experimental::Credit::CDefaultProbKey_Factory::Create ()
{
    return REFNEW CDefaultProbKey ();
}
/* <summary>Create a single dimension array of DefaultProbKey that can be passed into other function </summary> */
IVector<Cephei::QL::Experimental::Credit::IDefaultProbKey^>^ Cephei::QL::Experimental::Credit::CDefaultProbKey_Factory::CreateVector ()
 {
	 return REFNEW CoVector<IDefaultProbKey^> (REFNEW CDefaultProbKeyVector ());
 }
IVector<Cephei::QL::Experimental::Credit::IDefaultProbKey^>^ Cephei::QL::Experimental::Credit::CDefaultProbKey_Factory::CreateVector (PLATFORM::Collections::Generic::IEnumerable<IDefaultProbKey^>^ source)
 {
	 return REFNEW CoVector<IDefaultProbKey^> (source, REFNEW CDefaultProbKeyVector ());
 }
/* <summary>Create a single dimension array of DefaultProbKey with change events</summary> */
Cephei::Core::Generic::ICoCell<IVector<Cephei::Core::Generic::ICoCell<Cephei::QL::Experimental::Credit::IDefaultProbKey^>^>^>^ Cephei::QL::Experimental::Credit::CDefaultProbKey_Factory::CreateCellVector ()
 {
	 return CellFactory::Instance->Create<IVector<Cephei::Core::Generic::ICoCell<Cephei::QL::Experimental::Credit::IDefaultProbKey^>^>^> (REFNEW CoCellVector<Cephei::QL::Experimental::Credit::IDefaultProbKey^> (REFNEW CDefaultProbKeyVector ()));
 }
Cephei::Core::Generic::ICoCell<IVector<Cephei::Core::Generic::ICoCell<Cephei::QL::Experimental::Credit::IDefaultProbKey^>^>^>^ Cephei::QL::Experimental::Credit::CDefaultProbKey_Factory::CreateCellVector (PLATFORM::Collections::Generic::IEnumerable<Cephei::Core::Generic::ICoCell<Cephei::QL::Experimental::Credit::IDefaultProbKey^>^>^ source)
 {
	 return CellFactory::Instance->Create<IVector<Cephei::Core::Generic::ICoCell<Cephei::QL::Experimental::Credit::IDefaultProbKey^>^>^> (REFNEW CoCellVector<Cephei::QL::Experimental::Credit::IDefaultProbKey^> (source, REFNEW CDefaultProbKeyVector ()));
 }

